//
//  UICollectionViewCell+OF.m
//  HMmall
//
//  Created by 李李善 on 16/7/1.
//  Copyright © 2016年 吉青. All rights reserved.
//

#import "UICollectionViewCell+OF.h"
#import <objc/runtime.h>
const char * kPushedCollectionViewController;



@implementation UICollectionViewCell (OF)

- (UIViewController *)pushedViewController
{
    return objc_getAssociatedObject(self, kPushedCollectionViewController);
}


- (void)setPushedViewController:(UIViewController *)pushedViewController
{
    objc_setAssociatedObject(self, kPushedCollectionViewController, pushedViewController, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}



- (void)onAsInitAddView:(UIView *)view forViewController:(UIViewController *)ViewController forDataSource:(id)dataSource AtIndexPath:(NSIndexPath *)indexPath
{
    
}

- (void)update:(id)model forCollectionView:(UICollectionView *)CollectionView AtIndexPath:(NSIndexPath *)indexPath
{
    
}


@end


@implementation UIView (CollectionViewCell)


- (UICollectionViewCell *)findCollectionViewCell{
    UICollectionViewCell *c = (id)self.superview;
    int i = 0;
    while (![c isKindOfClass:[UICollectionViewCell class]]) {
        c = (id)c.superview;
        if (i==10) {return nil;}
        i++;
    }
    return c;
}


@end
